import request from '@/utils/request/request';
import { SysOauthClientRecord } from '@/api/system/model/sysOauthClientModel';

// 不分页查询令牌列表
export function querySysOauthClientRecordList(clientId: string) {
  if (clientId?.length > 0) {
    return request.get(`/api/oauth/client/${clientId}`);
  }
  return request.get('/api/oauth/client/list');
}

// 新增令牌
export function addSysOauthClientRecord(data: SysOauthClientRecord) {
  return request.post('/api/oauth/client', data);
}

// 修改令牌
export function editSysOauthClientRecord(data: SysOauthClientRecord) {
  return request.put('/api/oauth/client', data);
}

// 删除令牌，传id
export function deleteSysOauthClientRecord(clientId: string) {
  return request.delete(`/api/oauth/client/${clientId}`);
}

// 修改令牌密钥
export function updateClientSecret(data: any) {
  return request.put('/api/oauth/client/updateClientSecret', data);
}

// 重置令牌密钥
export function resetClientSecret(clientId: string) {
  return request.put(`/api/oauth/client/resetSecret?clientId=${clientId}`);
}
